splitData <- function(info, features, trainShare=0.9, classAttr="class"){
	if(trainShare>=1 || trainShare<=0){
		print("Wrong trainShare");
		return;
	}
	if(dim(info)[1]!=dim(features)[1]){
		print("info and features dimension mismatch");
		return;
	}
	crit=vector(mode="logical", length=dim(info)[1]);
	if(is.null(classAttr)){
		crit[sample(1:length(crit),length(crit)*trainShare,replace=FALSE)]=TRUE;
	}else{
		values=unique(info[classAttr])[,1];
		for(i in 1 : length(values)){
			matches = which(info[classAttr]==as.character(values[i]));
			crit[sample(matches, length(matches)*trainShare, replace=FALSE)]=TRUE;
		}
	}
	results<-list(
		trainFeatures=features[crit,],
		trainInfo=info[crit,],
		testFeatures=features[!crit,],
		testInfo=info[!crit,]);
	results;
}
